	import {ref,onMounted,computed,getCurrentInstance} from 'vue';

export function newGetInstance(){
	return getCurrentInstance();
}

export function getQuery(proxy){
	const instace = newGetInstance();
	return  uni.createSelectorQuery().in(proxy??instace.proxy)
}

// 获取某个元素的节点信息
export function getBoundingClientRect(proxy,selectName,fn,option={rect:true,size:true,scrollOffset:true}){
	let query = getQuery(proxy)
	const elm = query.select(selectName);
	elm.fields(option,res=>{
		fn(res);
	}).exec()
}

export function getBoundingClientRectAll(proxy,selectName,fn,option={rect:true,size:true,scrollOffset:true}){
	let query = getQuery(proxy)
	const elm = query.selectAll(selectName);
	try{
		elm.fields(option,res=>{
			fn(res);
		}).exec();
	}catch(e){
		console.log(e);
	}

}